export { default as calculate } from './calculate';
export {
  adjustColumnOrder,
  caculateColumnMargin,
  getAllFlatColumns,
  getColumn,
  getColumnDataKeyInfo,
  getColumnFormulaInfo,
  getColumnPinning,
  getColumnPinningDom,
  getColumnPinningInfo,
  getColumnPinningStyle,
  getColumnPinningWidth,
  getColumnRule,
  getColumnSize,
  getColumnTotalSize,
  getVisibleColumnSize,
  getVisibleFlatColumns,
  initColumnOrder,
  initColumnSummary,
  initColumnVisibility,
  initColumns,
  setColumnPinningInfo,
  setColumnPinningWidth,
  setColumnSize,
} from './column';
export {
  addSelectedRow,
  calculateTableFormula,
  createInitRowData,
  createInitTableData,
  createRowSelection,
  createTableId,
  createTableModalParams,
  createTableSchema,
  getAddHandler,
  getDeleteHandler,
  getDragTypes,
  getIsAllRowsSelected,
  getIsSelected,
  getSelectedRows,
  getTableRef,
  getUpdateHandler,
  handleDataKey,
  handleRowKey,
  removeSelectedRow,
  selectAllRow,
  selectRow,
  setSelectionDataSource,
  validateTable,
} from './table';

export function getElementStyle(element: any): CSSStyleDeclaration {
  if (window.getComputedStyle) {
    return window.getComputedStyle(element, null);
  } else {
    return element.currentStyle;
  }
}

export function getElementSize(
  element: Element,
  size: 'width' | 'height' = 'width',
) {
  if (element) {
    const sizeStyle = getElementStyle(element)[size];
    const v = Number(sizeStyle.replace('px', ''));
    return isNaN(v) ? 0 : v;
  }
  return 0;
}
